<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let input = `0 0 0 2 1`
        let count = 0;
        
        input = input.split(' ').map((v) => {
            v = parseInt(v, 10)
            count += v
            return v
        })
        let N = input.length

        let tag=0;
        let k=1;
        let num=new Array(5).fill(0)
        while(tag<count){
            let k_str=k+''
            if(k%7===0||k_str.includes('7')){
                num[(k-1)%5]++
                tag++
                k++
            }else{
                k++
            }
            
        }

        console.log(num);

    </script>
</body>

</html>